<h2>Hello <%= current_user.login -%></h2>

<%- unless current_user.identities.empty? -%>
<table>
	
	<tr>
		
		<th>
			Servicio
		</th>
		
		<th>
			Login
		</th>
		
		<th>
			&nbsp;
		</th>
		
		<th>
			Contactos
		</th>
		<th>
			&nbsp;
		</th>
	</tr>
	
	
<%- current_user.identities.each do |i| -%>
<td><%= i.service %></td>
<td><%= i.login %></td>
<td><%= link_to '[x]', identity_path(current_user, i), :method => 'delete' %></td>
<td><%= link_to i.contacts.size, contacts_path(current_user,i) %></td>

<td>
	<%- form_for :indentity, :url => synchronize_identity_path(current_user,i) do -%>
		<%=  submit_tag 'synchro' %>
	<%- end -%>
</td>

</tr>
<%- end -%>
</table>
<%- else -%>
<p>
	No external logins associated to your account yet.
</p>	
<%- end -%>

<%= error_messages_for :identity %>
<h2>Add</h2>
<% form_for(:identity, :url => identities_path(current_user)) do |f| %>
	
	<p><label>Service
		<%= f.select :service, ['flickr','lastfm'] %>
	</label>
	</p>

	<p>
		<%= f.text_field :login %>
  </p>

  <p>
    <%= submit_tag "Create" %>
  </p>
<% end %>


<%- if @contacts -%>
	<%= render :partial => 'shared/contact_list', :locals => {:contacts => @contacts} %>
<%- end -%>


<%- if current_user.activities -%>
<hr>

	<%= render :partial => 'shared/activity_list', :locals => {:activities => current_user.activities.reverse } %>
<%- end -%>


